<template>
	<view class="fee">
		<view class="">
			<!-- 2.0.19支持autoBack，默认为false -->
			<u-navbar leftText="共享养老详情" :autoBack="true">
			</u-navbar>

			<view class="con-body">
				<view class="uni-flex-center">
					<view class="main-service uni-cell-90" style="padding-bottom: 10rpx; width: 96%; margin-left: 2%;">
						<view class="user-list">
							<view class="title" style="height:80rpx;line-height: 80rpx;">
								<view style="float: left; clear: both;">
									<text>{{detail.title}}</text>
								</view>


							</view>
							<u-line></u-line>
							<view style="padding-left: 20rpx; padding-right: 20rpx; padding-bottom: 20rpx;">
								<view class="d_view">
									<text class="l_title">看护时间</text>
									<text class="d_content">{{detail.memo}}</text>
								</view>
								
								<view class="d_view" v-if="detail.fee == 0">
									<text class="l_title">看护费用</text>
									<text class="d_content">免费</text>
								</view>
								<view class="d_view" v-else>
									<text class="l_title">看护费用</text>
									<text class="d_content" style="color: red;">￥{{detail.fee}}元</text>
								</view>
							</view>
						</view>
					</view>
					
					<view class="main-service uni-cell-90" style="padding-bottom: 10rpx; width: 96%; margin-left: 2%;">
						<view class="user-list">
							<view style="padding:20rpx;">
								<view class="d_view">
									<text class="l_title">服务天数</text>
									<text class="d_content">{{detail.during}}</text>
								</view>
								<view class="d_view">
									<text class="l_title">服务时间</text>
									<text class="d_content">{{detail.time}}</text>
								</view>
								<view class="d_view">
									<text class="l_title">服务总费用</text>
									<text class="d_content">{{detail.fee * detail.during}}</text>
								</view>
								<view class="d_view">
									<text class="l_title">老人姓名</text>
									<text class="d_content">{{detail.older_name}}</text>
								</view>
								
								<view class="d_view">
									<text class="l_title">老人年龄</text>
									<text class="d_content">{{detail.older_age}}</text>
								</view>
								<view class="d_view">
									<text class="l_title">老人性别</text>
									<text class="d_content">{{detail.older_sex == btnStyle ? '女' : '男'}}</text>
								</view>
							</view>
						</view>
					</view>

					<view class="main-service uni-cell-90" style="padding-bottom: 10rpx; width: 96%; margin-left: 2%;">
						<view class="user-list">
							<view class="title" style="height:80rpx;line-height: 80rpx;">
								<view style="float: left; clear: both;">
									<text>提交人信息</text>
								</view>
							</view>
							<u-line></u-line>
							<view style="padding-left: 20rpx; padding-right: 20rpx; padding-bottom: 20rpx;">
								<view class="d_view">
									<text class="l_title">联系人</text>
									<text class="d_content">{{detail.name}}</text>
								</view>

								<view class="d_view">
									<text class="l_title">联系电话</text>
									<text class="d_content">{{detail.tel}}</text>
								</view>
								<view class="d_view">
									<text class="l_title">户号</text>
									<text class="d_content">{{detail.house}}</text>
								</view>
							</view>
							
						</view>
					</view>
					<view class="main-service uni-cell-90" style="padding-bottom: 10rpx; width: 96%; margin-left: 2%;margin-bottom:30rpx;" v-if="detail.status >0 ">
						<view class="user-list">
							<view class="title" style="height:80rpx;line-height: 80rpx;">
								<view style="float: left; clear: both;">
									<text>工单信息</text>
								</view>
					
					
							</view>
							<u-line></u-line>
							<view style="padding-left: 20rpx; padding-right: 20rpx; padding-bottom: 20rpx;">
								<view class="d_view">
									<text class="l_title">负责人</text>
									<text class="d_content">{{detail.examine.author}}</text>
								</view>
								<view class="d_view">
									<text class="l_title">进度时间</text>
									<text class="d_content">{{$u.timeFormat(detail.examine.create_time, 'yyyy年mm月dd日')}}</text>
								</view>
					
								<view class="d_view">
									<text class="l_title">审核备注</text>
									<text class="d_content" v-if="detail.examine.status == 1" style="color: green;">{{detail.examine.memo}}</text>
									<text class="d_content" v-else style="color: red;">{{detail.examine.memo}}</text>
								</view>
							</view>
						</view>
					</view>
					<u-toast ref="uToast"></u-toast>
					<u-modal :show="showDel" title="确定删除此条共享养老订单吗？" width="500rpx" @confirm="confirmdel" @cancel="showDel = false"  showCancelButton></u-modal>
					<view v-if="detail.status == 3 || detail.status == -1">
						<u-button :customStyle="btnStyle" @click="showDel = true">删除</u-button>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { getOlderDetail,delOld } from "@/service/shareService.js";
	export default {
		data() {
			return {
				id: 0,
				showDel: false,
				detail: {},
				statusIcon: [

				],
				btnStyle: {
					width: '96%',
					borderRadius: '40rpx',
					marginTop: '40rpx',
					marginBottom: '40rpx',
					backgroundImage: "url('https://s4.ax1x.com/2022/02/22/HxzlJf.png')",
					backgroundSize: '100% 80rpx',
					color: '#FFFFFF'
				},
			}
		},
		onLoad(options) {
			this.id = options.id;
			getOlderDetail({id: this.id}).then(this.getDetail)
		},
		methods: {
			getDetail(e) {
				let list = [];
				if(e.code == 200){
					list = e.result;
				}

				this.detail = list;
			},
			// 删除
			confirmdel(){
				delOld({
					id:this.id
				}).then(res=>{
					if(res.code==200){
						this.showDel=false;
						this.$refs.uToast.show({
						
							type: 'success',
							title: '成功',
							message: res.msg,
							complete() {
								uni.navigateBack()
							}
						})
					}else{
						this.$refs.uToast.show({
						
							type: 'error',
							title: '失败',
							message: res.msg,
							complete() {
								
							}
						})
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.l_title {
		font-size: 32rpx;
		color: #999999;
		float: left;
	}

	.d_content {
		color: #666666;
		font-size: 32rpx;
	}

	.d_view {
		width: 100%;
		margin-top: 30rpx;
		text-align: right;
		clear: both;
	}
	.d_view image{
		width:200rpx;
		height:200rpx;
	}
</style>

